require "localization"
local ffi = require "ffi"

local loader = {}
	
loader.load = function(path)
	--[[
	if global_config["MapTest"]["VirtualMpq"] == "" then
		log.warn('failed: disable')
		return false
	end
	]]
	local s, r = pcall(ffi.load, __(path:string()))
			
	if not s then
		log.error('failed: ' .. r)
		return false
	end
	loader.dll = r
--
	ffi.cdef[[
		bool unload(void);
	]]
--[[
	if not loader.dll.SetFontByName(name, tonumber(size)) then
		log.error('failed: in YDFont.dll!SetFontByName')
		return  false
	end
]]
	return true
end

loader.unload = function()
	loader.dll.unload()
end

return loader
